<template>
  <div>
      <el-table
    :data="stuData"
    stripe
    style="width: 100%">
    <el-table-column
      prop="stuNumber"
      label="学号"
      width="180">
    </el-table-column>
    <el-table-column
      prop="stuName"
      label="姓名">
    </el-table-column>

    <el-table-column
      prop="className"
      label="班级"
      width="180">
    </el-table-column>

    <el-table-column
      label="作业完成">
      <template slot-scope="scope">
        {{scope.row.submitInfo.submitCount}}/{{workCount}}
      </template>
    </el-table-column>

    <el-table-column
      prop="submitInfo.scoreCount"
      label="得分">
    </el-table-column>

    <el-table-column
      prop="stuEmail"
      label="邮箱"
      width="180">
    </el-table-column>
      
    <el-table-column
      prop="stuPhone"
      width="180"
      label="手机号">
    </el-table-column>

    <el-table-column
      fixed="right"
      label="操作">
      <template slot-scope="scope">
        <el-button @click="handleDelStu(scope.row.stuId)" type="text" size="small">踢出课堂</el-button>
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>

<script>
import * as API from '../../api/course/index'

export default {
  props:['courseId'],
  data() {
    return {
      workCount:0,
      stuData: [
            // {
            // stuId: '541713140206',
            // stuName: '胡一涵',
            // phone: '15890373389',
            // className: "3G软件1702",
            // email: "787356076@qq.com",
            // workInfo:"5/10",
            // score:100,
            // },
            // {
            // stuId: '541713140206',
            // stuName: '胡一涵',
            // phone: '15890373389',
            // className: "3G软件1702",
            // email: "787356076@qq.com",
            // workInfo:"5/10",
            // score:100,
            // },
            // {
            // stuId: '541713140206',
            // stuName: '胡一涵',
            // phone: '15890373389',
            // className: "3G软件1702",
            // email: "787356076@qq.com",
            // workInfo:"5/10",
            // score:100,
            // },
            // {
            // stuId: '541713140206',
            // stuName: '胡一涵',
            // phone: '15890373389',
            // className: "3G软件1702",
            // workInfo:"5/10",
            // email: "787356076@qq.com",
            // score:100,
            // },
      ]
    }
  },
  methods: {
    getStusInCourse() {
      if(this.courseId != undefined) {
        API.getStusInCourse(this.courseId).then(res => {
          if(res.code == 200) {
            this.stuData = res.data.stus
            this.workCount = res.data.workCount
          }else {
            this.$message.error("网络不太好， err：" + res.data.error )
          }
        }).catch(err => {
          this.$message.error('网络有问题，err:' + err);
        })

      }
    },
    handleDelStu(stuId) {
      console.log(stuId)
    }
  },
  mounted() {
    this.getStusInCourse()
  }
}
</script>

<style>

</style>